
import java.sql.* ;
import java.util.*;
import java.io.*;

class MysqlTest
{

     Connection conn;
     Statement stmt;
     static ResultSet rs; 
 public void test()
 {

    try
    {
       // Load the database driver
       Class.forName( "com.mysql.jdbc.Driver" ) ;

       //Scanner fileReader = new Scanner(new File("sqlconnect.txt"));
       //conn = DriverManager.getConnection( fileReader.nextLine());
      conn = DriverManager.getConnection( "jdbc:mysql://localhost:3306/dental clinic archrive?user=root&password=root123" ) ;

       // Print all warnings
       for( SQLWarning warn = conn.getWarnings(); warn != null; warn = warn.getNextWarning() )
       {
          System.out.println( "SQL Warning:" ) ;
          System.out.println( "State  : " + warn.getSQLState()  ) ;
          System.out.println( "Message: " + warn.getMessage()   ) ;
          System.out.println( "Error  : " + warn.getErrorCode() ) ;
       }

       

       // Close the result set, statement and the connection
       //rs.close() ;
      // stmt.close() ;
      // conn.close() ;
   }
   catch( SQLException se )
   {
       System.out.println( "A problem has been encountered. Cannot access database." ) ;

       // Loop through the SQL Exceptions
       while( se != null )
       {
          System.out.println( "State  : " + se.getSQLState()  ) ;
          System.out.println( "Message: " + se.getMessage()   ) ;
          System.out.println( "Error  : " + se.getErrorCode() ) ;

          se = se.getNextException() ;
       }
   }
   catch( Exception e )
   {
      System.out.println( e ) ;
   }
 }
 
}